#!/usr/bin/bash

#循环判断是否启动守护线程，端口监听需要一定时间
flag=true
while($flag)
	do
		flag=true
		if [ $(ps -ef | grep -c "lotus daemon") -gt 0 ] && [ $(ss -antlup | grep -c 1234) -gt 0 ]; 
			then flag=false; 
		fi
	done

echo "继续。。"

echo "正在启动矿工"
rm ~/lotusDir/log/lotus-storage-miner-run.log
touch ~/lotusDir/log/lotus-storage-miner-run.log
#存储矿工挖矿
nohup lotus-storage-miner run >> ~/lotusDir/log/lotus-storage-miner-run.log 2>&1 &

echo "lotus-storage-miner running , 监控日志 : ~/lotusDir/log/lotus-storage-miner-run.log"